<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}{% end %} - Pypress by tornado</title>
    <link rel="stylesheet" href="{{ reverse_url('theme_static','base.css') }}" />
    {% block css %}{% end %}
    <script type="text/javascript" src="{{ static_url('js/jquery.min.js') }}"></script>
    <script type="text/javascript">
    $(function(){
        $("#go-to-top").click(function(){
            $("html, body").animate({'scrollTop': 0}, 400);
            return false;
        });
        $(window).scroll(function() {
            var top = $(document).scrollTop();
            var g = $("#go-to-top");
            if (top > 300 && g.is(":hidden")) {
                g.fadeIn();
            } else if(top < 300 && g.is(":visible")) {
                g.fadeOut();
            }
        });
    })
    </script>
    {% block js %}{% end %}
    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-30950818-1']);
      _gaq.push(['_setDomainName', 'laoqiu.com']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>
</head>
<body>
<div id="wrap">
    {% set messages = handler.get_flashed_messages() %}
    {% if messages %}
    <div id="flashed">
        {% for category, msg in messages %}
        <span class="flash-{{ category }}">{{ msg }}</span>
        {% end %}
    </div>
    {% end %}
    <div id="header">
        <div class="inner">
            <h1>Pypress</h1>
            <p class="desc">由python编写的团队博客</p>
            <div id="nav">
                <ul>
                    <li>
                        <a href="/">{{ _("Home") }}</a>
                    </li>
                    <li>
                        <a href="{{ reverse_url("tags") }}">{{ _("Tags") }}</a>
                    </li>
                    <li>
                        <a href="{{ reverse_url("archives") }}">{{ _("Archives") }}</a>
                    </li>
                    <li>
                        <a href="{{ reverse_url("links") }}">{{ _("Links") }}</a>
                    </li>
                    <li>
                        <a href="{{ reverse_url('post') }}">{{ _("Post Now") }}</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div id="menu">
    {% if current_user %}
        {{ current_user.username }}
        <small><a href="/logout">{{ _("logout") }}</a></small>
    {% else %}
        <small><a href="/login">{{ _("login") }}</a></small>
    {% end %}
    </div>
    <div id="container">
        <div class="inner clearfix">
            <div class="content">
            {% block content %}{% end %}
            </div>
            {% block sidebar %}
            <div class="sidebar">
                {% block search %}
                <div id="search" class="sidebar-module">
                    <form action="{{ reverse_url('search') }}">
                        <input name="q" type="text" class="text" />
                    </form>
                </div>
                {% end %}
                {% block tag_cloud %}
                <div id="tags" class="sidebar-module">
                    <h3>{{ _("Tags") }}</h3>
                    {% set tag_cloud = handler.get_cached_items('tags') %}
                    {% if tag_cloud %}
                    <ul>
                        {% for tag in tag_cloud %}
                        <li><a href="{{ tag.url }}" class="tag-{{ tag.size>10 and 10 or tag.size }}">{{ tag.name }}</a></li>
                        {% end %}
                    </ul>
                    {% else %}
                    <div class="error-no-data">{{ _('No tags') }}</div>
                    {% end %}
                </div>
                {% end %}
                {% block latest_coments %}
                <div class="sidebar-module">
                    <h3>{{ _("Latest comments") }}</h3>
                    {% set comments = handler.get_cached_items('latest_comments')[:5] %}
                    {% if comments %}
                    <ul>
                        {% for comment in comments %}
                        <li>
                        {{ comment.comment }} <a href="{{ comment.url }}">#{{ comment.author.nickname }} {{ locale.format_day(comment.created_date, dow=False) }}</a>
                        </li>
                        {% end %}
                    </ul>
                    {% else %}
                    <div class="error-no-data">{{ _('No comments have been posted yet.') }}</div>
                    {% end %}
                </div>
                {% end %}
                {% block links %}
                <div class="sidebar-module">
                    <h3>{{ _("Links") }}</h3>
                    {% set links = handler.get_cached_items('links') %}
                    {% if links %}
                    <ul>
                        {% for link in links %}
                        <li>
                        <a href="{{ link.url }}" target="_blank">{{ link.name }}</a> #{{ link.description }}
                        </li>
                        {% end %}
                    </ul>
                    {% else %}
                    <div class="error-no-data">{{ _('No links') }}</div>
                    {% end %}
                    <div class="sidebar-module-foot"><a href="{{ reverse_url('link_add') }}">{{ _('Apply friend link') }}</a></div>
                </div>
                {% end %}
            </div>
            {% end %}
        </div>
    </div>
    <div id="footer">
        <div class="inner">
            <p class="info"><span>Copyright &copy; laoqiu Аll Rights Reserved. </span>Powered by PyPress. </p>
        </div>
    </div>
</div>
<a style="display:none;" rel="nofollow" href="#header" id="go-to-top">▲</a>
</body>
</html>
